package com.cuit.controller;

import com.cuit.pojo.Comment;
import com.cuit.service.ArticleService;
import com.cuit.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/comment")
public class CommentController {
    @Autowired
    CommentService commentService;
    @RequestMapping("/findCommentByArticleId")
    public List<Comment> findCommentByArticleId(int articleId){
        return commentService.findCommentByArticleId(articleId);
    }
    @RequestMapping("/insertComment")
    public void insertComment(String commentText,int userId,int articleId){
        commentService.insertComment(commentText,userId,articleId);
    }
}
